package com.shopping.mall.core.module.goodsSpecification.mapper;

import com.shopping.mall.core.module.goodsSpecification.entity.NumPrice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shopping.mall.core.module.goodsSpecification.entity.NumPriceList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * NumPriceMapper 接口
 * </p>
 *
 * @author zzy
 * @since 2021-08-29
 */
@Mapper
public interface NumPriceMapper extends BaseMapper<NumPrice> {

    /**
     * 获取该规格所有数量价格
     * @param specificationIds
     * @return
     */
    List<NumPriceList> selectNumPriceList(List<String> specificationIds);

    @Select("select MIN(real_price) from num_price where specification_id = #{specificationId} and number <= #{number}")
    Double getPrice(Integer number, String specificationId);
}
